package org.toycode.logindemo.entity;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Entity;
import javax.persistence.Temporal;

/**
 * Article entity.
 *
 * @author <a href="mailto:DL88250@gmail.com">Liang Ding</a>
 * @version 1.0.0.0, Aug 31, 2009
 */
@Entity
public class Article extends AbstractDataTable implements Serializable {

    /**
     * generated default serial version id.
     */
    private static final long serialVersionUID = 1L;
    /**
     * author of this article.
     */
    private String author;
    /**
     * publish date of this article.
     */
    @Temporal(javax.persistence.TemporalType.DATE)
    private Date publishDate;

    /**
     * Gets the publish date of this article.
     *
     * @return the publish date of this article
     */
    public Date getPublishDate() {
        return publishDate;
    }

    /**
     * Sets the publish date of this article.
     *
     * @param publishDate new value of the publish date of this article
     */
    public void setPublishDate(final Date publishDate) {
        this.publishDate = publishDate;
    }

    /**
     * Gets the author of this article.
     *
     * @return the author of this article
     */
    public String getAuthor() {
        return author;
    }

    /**
     * Sets the author of this article.
     *
     * @param author new value of the author of this article
     */
    public void setAuthor(final String author) {
        this.author = author;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public boolean equals(final Object obj) {
        if (!(obj instanceof Article)) {
            return false;
        }
        Article other = (Article) obj;
        if ((this.id == null && other.id != null) ||
            (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }
}
